<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>好运网</title>
    <link rel="stylesheet" type="text/css" href="/css/basic.css"/>
    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
</head>

<body>
<div th:include="header::header"></div>
<div class="container">
    <div class="find_pwd_box">
        <div class="find_pwd_step">
            <div class="find_pwd_line">
                <div>
                    <span>1</span>
                    <p>填写验证码</p>
                </div>
                <div class="on">
                    <span>2</span>
                    <p>修改密码</p>
                </div>
                <div>
                    <span>3</span>
                    <p>完成</p>
                </div>
            </div>
        </div>
        <div class="find_pwd_step_one">
            <div class="find_pwd_newpws">
                <h3>
                    创建新密码
                </h3>
                <div class="from_Centered">
                    <form id="password_form" method="post">
                        <div class="setting_pwd_box_row">
                            &nbsp;&nbsp;&nbsp;新密码：
                            <input type="password" name="newpassword" id="newPass" class="r_inptut inputwd300"/>
                        </div>
                        <div class="setting_pwd_box_row">
                            确认密码：
                            <input type="password" name="confirmpassword" id="confirmPass" class="r_inptut inputwd300"/>
                        </div>
                        <div class="setting_pwd_box_row" style="margin-top:15px;">
                            <button id="btnNext" class="as_but inputwd300" type="button">下一步</button>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
<div th:include="footer::footer"></div>
<div th:include="right::right"></div>
</body>
<link rel="stylesheet" href="/js/loading/loading.css">
<script src="/js/loading/loading.js"></script>
<script>
    var jiuXiuLoad = new Loading();
    jiuXiuLoad.init();
    $(function () {
        $("#btnNext").click(function () {
            var newPass = $("#newPass").val();
            var confirmPass = $("#confirmPass").val();
            if (newPass.length == 0 || confirmPass.length == 0) {
                alertWorning("密码不能为空!");
                return;
            }
            if (newPass != confirmPass) {
                alertWorning("两次密码输入不一致!");
                return;
            }

            jiuXiuLoad.start();
            $.ajax({
                method: "POST",
                url: "/api/reSetPassword",
                data: $("#password_form").serializeArray(),
                dataType: "json"
            }).done(function (msg) {
                jiuXiuLoad.stop();
                if (msg.status == 'success') {
                    window.location.href = msg.data;
                } else {
                    alertWorning(msg.data)
                }
            });
        });
    });
</script>
</html>
